tags = {
    name: "/schedules",
    description: "排片管理模块",
};

schemas = {
    schedules: {
        // 用来描述用户的属性
        properties: {
            _id: {
                type: "string",
                description: "用户唯一标识",
            },
            movieId: {
                type: "ObjectId",
                description: "电影id",
            },
            cinemasId: {
                type: "ObjectId",
                description: "影院id",
            },
            theaterId: {
                type: "ObjectId",
                description: "放映厅id",
            },
            showTime: {
                type: "string",
                description: "当前时间",
            },
            showDate: {
                type: "string",
                description: "当前日期",
            },
            price: {
                type: "string",
                description: "价格",
            },
        },
    },
    ArrayOfschedules: {
        properties: {
            total: {
                type: "number",
                description: "总数",
            },
            maxPage: {
                type: "number",
                description: "总页数",
            },
            rows: {
                type: "array",
                description: "排片",
                items: {
                    $ref: "#/components/schemas/schedules",
                },
            },
        },

},
}

paths = {
    "/schedules": {
        get: {
            tags: ["schedules"],
            summary: "排片列表",
            description: "渲染排片列表",
            // 请求的数据类型 json
            consumes: ["application/json"],
            // 请求参数
            parameters: [
                {
                    name: "curPage",
                    in: "query",
                    schema: {
                        type: "integer",
                        default: 1,
                    },
                    required: true,
                    description: "当前页码",
                },
                {
                    name: "eachPage",
                    in: "query",
                    schema: {
                        type: "integer",
                        default: 1,
                    },
                    required: true,
                    description: "每页条数",
                },
            ],
            responses: {
                // http 状态码
                200: {
                    description: "操作成功",
                    content: {
                        "application/json": {
                            schema: {
                                $ref: "#/components/schemas/schedules",
                            },
                        },
                    },
                },
                404: {
                    description: "找不到资源",
                },
                500: {
                    description: "服务端内部错误",
                },
            },
        },
    },
    "/schedules/addSchedules": {
        post: {
            tags: ["schedules"],
            summary: "新增排片接口",
            description: "新增排片信息",
            // 请求参数
            requestBody: {
                // 必填
                required: true,
                // 内容
                content: {
                    "application/json": {
                        // 结构
                        schema: {
                            $ref: "#/components/schemas/schedules",
                        },
                        example: {
                            movieId: "悬崖之上",
                            cinemasId: "万达影院",
                            theaterId: "三号厅",
                            showDate: "2021-8-2",
                            showTime: "20:00",
                            price: "34",
                        },
                    },
                },
            },
            responses: {
                // http 状态码
                200: {
                    description: "操作成功",
                    content: {
                        "application/json": {
                            schema: {
                                $ref: "#/components/schemas/schedules",
                            },
                        },
                    },
                },
                404: {
                    description: "找不到资源",
                },
                500: {
                    description: "服务端内部错误",
                },
            },
        },
    },
    "/schedules/search": {
        get: {
            tags: ["schedules"],
            summary: "根据影院查询排片",
            description: "根据影院 _id 查询排片",
            // 请求的数据类型 json
            consumes: ["application/json"],
            // 请求参数
            parameters: [
                {
                    name: "cinemasId",
                    in: "query",
                    schema: {
                        type: "string",
                        default: "615191b7b6ce2a33e8786592",
                    },
                    required: true,
                    description: "影院id",
                },
            ],
            responses: {
                // http 状态码
                200: {
                    description: "操作成功",
                    content: {
                        "application/json": {
                            schema: {
                                $ref: "#/components/schemas/schedules",
                            },
                        },
                    },
                },
                404: {
                    description: "找不到资源",
                },
                500: {
                    description: "服务端内部错误",
                },
            },
        },
    },
    "/schedules/searchmovies": {
        get: {
            tags: ["schedules"],
            summary: "根据电影查询排片",
            description: "根据电影 _id 查询排片",
            // 请求的数据类型 json
            consumes: ["application/json"],
            // 请求参数
            parameters: [
                {
                    name: "movieId",
                    in: "query",
                    schema: {
                        type: "string",
                        default: "614d673f0037f4201c411b22",
                    },
                    required: true,
                    description: "影院id",
                },
            ],
            responses: {
                // http 状态码
                200: {
                    description: "操作成功",
                    content: {
                        "application/json": {
                            schema: {
                                $ref: "#/components/schemas/schedules",
                            },
                        },
                    },
                },
                404: {
                    description: "找不到资源",
                },
                500: {
                    description: "服务端内部错误",
                },
            },
        },
    },
};

module.exports = { tags, schemas, paths };